<template>
  <q-page class="cc-admin">

    <div class="col bg-white shadow-2 q-pa-md q-ma-sm">
      <q-table flat color="primary" class="cross_table" separator="cell" :columns="columns" :data="list" row-key="id" :pagination.sync="pagination" :visible-columns="group" @request="query" :rows-per-page-options="[10, 20, 50, 100]" selection="multiple" :selected.sync="selected">

        <template v-slot:top="table">
          <div class="row no-wrap full-width">
            <q-input clearable outlined dense placeholder="请输入关键字搜索" class="on-left" @input="query" debounce="500" v-model="key">
              <template #append>
                <q-btn flat round icon="search" color="primary" @click="query" :loading="loading">
                  <q-tooltip>搜索</q-tooltip>
                </q-btn>
              </template>
            </q-input>
            <q-space />
            <template>
              <div class="q-gutter-xs">
                <q-btn icon="add" no-wrap color="primary" label="新建" @click="add" />
                <slot />
              </div>
            </template>
          </div>
        </template>
        <template #body-cell-opt="props">
          <q-td :props="props" :auto-width="true">
            <q-btn flat round dense color="primary" icon="edit" @click="edit(props.row)"> <q-tooltip>编辑</q-tooltip></q-btn>
            <q-btn flat round dense color="primary" icon="mdi-content-copy" @click="copy(props.row)">
              <q-tooltip>复制</q-tooltip>
            </q-btn>
            <btn-del label="海雾预警表" @confirm="del(props.row)" />
          </q-td>
        </template>
      </q-table>
    </div>
    <q-dialog maximized flat persistent ref="dialog">
      <q-form @submit="submit" class="dialog_card column">
        <h5 class="view_title justify-between q-px-md">
          {{ editType }}海雾预警表
          <q-btn dense outline round icon="clear" size="sm" v-close-popup />
        </h5>
        <q-scroll-area class="col">
          <div class="row q-col-gutter-x-md dialog_form q-pa-md">
            <div class="col-12">
              <h5> 代码值：</h5>
              <q-input outlined dense v-model="form.key" type="text" />
            </div>
            <div class="col-12">
              <h5> 数据起报时间：</h5>
              <q-input outlined dense v-model="form.reportDate" type="text" />
            </div>
            <div class="col-12">
              <h5> 数据预报时间：</h5>
              <q-input outlined dense v-model="form.forecastDate" type="text" />
            </div>
            <div class="col-12">
              <h5> 代码值说明：</h5>
              <q-input outlined dense v-model="form.mark" type="text" />
            </div>
          </div>
        </q-scroll-area>
        <div class="row justify-center q-pa-md">
          <q-btn outline color="primary" icon="mdi-close-thick" label="关闭" v-close-popup />
          <q-btn class="q-mx-md" color="primary" icon="mdi-check-bold" label="提交" :loading="loading" type="submit" />
        </div>
      </q-form>
    </q-dialog>
    <confirm ref="confirmDialog" :msg="confirmMsg" @confirm="deleteBatch()" />
    <q-inner-loading :showing="loading">
      <q-spinner-gears size="50px" color="primary" />
    </q-inner-loading>
  </q-page>
</template>

<script>
import { IndexMixin } from 'boot/mixins';
import { getDictLabel } from 'boot/dictionary';
import confirm from 'components/confirm';

export default {
  name: 'WeaSeaFog',
  mixins: [IndexMixin],
  components: {
    confirm,
  },
  data() {
    return {
      columns: [
        {
          name: 'index',
          align: 'center',
          label: '序号',
          field: 'index',
        },
        {
          name: 'id', align: 'left', label: '编号', field: 'id',
        },
        {
          name: 'key', align: 'left', label: '代码值', field: 'key',
        },
        {
          name: 'reportDate', align: 'left', label: '数据起报时间', field: 'reportDate',
        },
        {
          name: 'forecastDate', align: 'left', label: '数据预报时间', field: 'forecastDate',
        },
        {
          name: 'mark', align: 'left', label: '代码值说明', field: 'mark',
        },
        {
          name: 'opt', align: 'center', label: '操作', field: 'id',
        },
      ],
      showQuery: true,
      headers: [{ name: 'Authorization', value: localStorage.Authorization }],
      uploadUrl: `${process.env.SERVER_URL}${process.env.BASE_URL}/sys/common/upload`,
      imgUrl: `${process.env.SERVER_URL}${process.env.BASE_URL}/sys/common/static`,
      url: {
        list: '/wea/seaFog/list',
        add: '/wea/seaFog/add',
        edit: '/wea/seaFog/edit',
        copy:
          '/wea/seaFog/copy',
        delete: '/wea/seaFog/delete',
        deleteBatch: '/wea/seaFog/deleteBatch',
        exportXlsUrl: '/wea/seaFog/exportXls',
        importExcelUrl: '/wea/seaFog/importExcel',
      },
    };
  },
  methods: {
    getDictLabel,
    initDict() {
    },
  },
  mounted() {
    this.initDict();
  },
};
</script>

<style lang="stylus">

</style>
